package com.example.eventlistener.listener;

import com.example.eventlistener.event.MyEvent;
import com.example.eventlistener.event.MyEvent_two;

import lombok.extern.log4j.Log4j;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Component;

/**
 * @Description : 事件监听器
 * @Author : Bruce Lee
 * @CreateTime : 2023/11/21
 */

@Slf4j
@Component
public class MyListener {

    @EventListener
    public void listener_one(MyEvent event) {
        log.info("事件一发布: {}", event.getMsg());
    }


    @EventListener
    public void listener_two(MyEvent_two event) {
        log.info("事件二发布: {}", event.getMsg());
    }
}
